import java.util.HashSet;
import java.util.Set;

public class Concept {
	private String name;
	private Set<Concept> allParentConcepts; 
	private Set<Service> inputServices;  //services that take this concept as input
	private Set<Service> outputServices;  //services that output this concept
	
	public Concept(String name) {
		this.name = name;
		allParentConcepts = new HashSet<Concept>();
		inputServices = new HashSet<Service>();  
		outputServices = new HashSet<Service>();
	}
	
	public void setInputServices() {
		Set<Service> allServices = new HashSet<Service>();
		for(Service s : allServices) {
			if(s.getInputConcepts().contains(this))
				this.inputServices.add(s);
		}
	}
	
	public void setOutputServices(Service service) {
		outputServices.add(service);
	}
	
	public String getName() {
		return name;
	}
	
	public Set<Concept> getAllParentConcepts() {
		return allParentConcepts;
	}
	
	public Set<Service> getInputServices() {
		return inputServices;
	}
	
	public Set<Service> getOutputServices() {

		return outputServices;
	}
	
	@Override
    
	public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj == null || obj.getClass() != this.getClass()) {
            return false;
        }

        Concept other = (Concept) obj;
        return name == other.name;
    }
   
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + name.hashCode();
        return result;
    }

}
